package com.loan.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.loan.group.*;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
public class Contract implements Serializable {
    @TableId(value = "id",type = IdType.AUTO)
    @NotNull(message = "合同的id不能为空",groups = {ContractUpdateGroup.class, ContractSingleSelectGroup.class})
    private Integer id;

    @TableField("pro_id")
    @NotNull(message = "选择的产品不能为空",groups = {ContractAddGroup.class})
    private Integer proId;

    @TableField("emp_id")
    @NotNull(message = "业务员的信息不能为空",groups = {ContractAddGroup.class, ContractUpdateGroup.class, ContractArrayGroup.class})
    private Integer empId;

    @TableField("cus_id")
    @NotNull(message = "客户的信息不能为空",groups = {ContractAddGroup.class,ContractUpdateGroup.class})
    private Integer cusId;

    @NotBlank(message = "修改合同信息，合同编号不能为空",groups = {ContractUpdateGroup.class,ContractUpdateLoanGroup.class,
            ContractSingleSelectGroup.class,ContractArrayGroup.class})
    private String number;

    @NotNull(message = "贷款的金额不能为空",groups = {ContractAddGroup.class,ContractUpdateGroup.class})
    private BigDecimal money;

    private Date time;

    private String loan;

    private Integer frequency;

    private BigDecimal debt;

    private String confirm;

    @NotBlank(message = "收款账号不能为空",groups = {ContractAddGroup.class,ContractUpdateGroup.class})
    private String acceptAccount;

    @TableField(exist = false)
    private Product product;

    @TableField(exist = false)
    private User user;

    @TableField(exist = false)
    private Emp emp;

}